package com.demo.supplier.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 登录日志实体类（MongoDB）
 * 
 * @author demo
 */
@Data
@Document(collection = "login_logs")
@ApiModel("登录日志实体")
public class LoginLog implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @ApiModelProperty("日志ID")
    private String id;

    @ApiModelProperty("用户ID")
    private Long userId;

    @ApiModelProperty("用户名")
    private String username;

    @ApiModelProperty("登录类型")
    private String loginType;

    @ApiModelProperty("登录结果")
    private String loginResult;

    @ApiModelProperty("IP地址")
    private String ip;

    @ApiModelProperty("登录地点")
    private String location;

    @ApiModelProperty("失败原因（仅在登录失败时使用）")
    private String failureReason;

    @ApiModelProperty("用户代理")
    private String userAgent;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
}